import req from "../utils/http.js"
// 账号密码登录
export function getAccountLogin(username,password) {
    let parms = new URLSearchParams()
    parms.append("username", username)
    parms.append("password", password)
    parms.append("rememberMe",true)
    return req.post(`/api/pcUser/login`,parms)
}
// 手机登录获取手机验证码
export function getLoginPhoneCode(phoneNum) {
    return req.get(`/api/pcUser/login/send/code/${phoneNum}`,)
}
// 手机号登录 已经出问题了, 后续解决(请解决后删除这段话)
export function getPhoneLogin(mobile,code) {
    let parms = new URLSearchParams()
    parms.append("mobile", mobile)
    parms.append("code", code)
    return req.post(`/pcUser/login/mobile`,parms)
}
// 注册接口
export function getRegisteredInterFace(loginName,code,mobile,password,nickname) {
    let parms = new URLSearchParams()
    parms.append("loginName", loginName)
    parms.append("code", code)
    parms.append("mobile",mobile)
    parms.append("password",password)
    parms.append("nickname",nickname)
    return req.post(`/api/pcUser/register`,parms)
}
// 获取注册验证码
export function getRegisterPhoneCode(phoneNum) {
    return req.get(`/api/pcUser/register/send/code/${phoneNum}`,)
}
// 获取忘记密码验证码
export function getForgotPhoneCode(loginName,mobile) {
    let parms = new URLSearchParams()
    parms.append("loginName", loginName)
    parms.append("mobile", mobile)
    return req.post(`/api/pcUser/forgetpassword/send/code`,parms)
}
// 忘记密码接口
export function getForgotInterFace(loginName,password,mobile,code) {
    const parms= {
        "loginName":`${loginName}`,
        "password": `${password}`,
        "mobile": `${mobile}`,
        "code": `${code}`
      }
    return req.post(`/api/pcUser/password/forget`,parms)
}   

// 修改头像
export function getModifyAvatar(file) {
    const parms=new FormData()
    parms.append("file",file)
    return req.post(`/api/pcUser/updata/userAvatar`,parms)
}
// 查看当前登录个人信息
export function getCurrentLoginUserInfo() {
    return req.get(`/api/pcUser/login-user/info`,)
}

// 修改昵称接口
export function getModifyNickName(nickname) {
    const parms= {
        "nickname":`${nickname}`,
      }
    return req.post(`/api/pcUser/update/userInfo`,parms)
}
// 修改用户手机接口
export function getModifyUserPhone(mobile,code) {
    const parms= {
        "mobile":`${mobile}`,
        "code":`${code}`,
      }
    return req.post(`/api/pcUser/update/userInfo`,parms)
}
// 获取验证码
export function getModifyUserPhoneCode(mobile) {
    return req.get(`/api/pcUser/short-message/vcode/${mobile}`,)
}
// 退出登录
export function exitLogin(){
    return req.get('/api/pcUser/logout')
}

// 我的学习课程等
export function getMyCourse(){
    return req.get('/api/weChat/applet/course/init/myCourse')
}
